home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Speccy ClassiX 1998
/
Speccy ClassiX 98.iso
/
amiga_system
/
the_aminet
/
dev
/
c
/
asyncio.lha
/
AsyncIO
/
src
/
WriteCharAsync.c
< prev
Wrap
C/C++ Source or Header
|
1995-09-09
|
637b
|
28 lines
#include "async.h"
LibCall LONG
WriteCharAsync( _REG( a0 ) AsyncFile *file, _REG( d0 ) UBYTE ch )
{
if (file->af_BytesLeft)
{
/* if there's any room left in the current buffer, directly write
* the byte into it, updating counters and stuff.
*/
*file->af_Offset = ch;
file->af_BytesLeft--;
++file->af_Offset;
/* one byte written */
return( 1 );
}
/* there was no room in the current buffer, so call the main write
* routine. This will effectively send the current buffer out to disk,
* wait for the other buffer to come back, and then put the byte into
* it.
*/
return( WriteAsync( file, &ch, 1 ) );
}